<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<script src="js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/spinner.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<input type="text" id="username" value="" />
		<input type="text" id="userpass" value="" />
		<button id="btn" type="button">提交</button>
		<script type="text/javascript">
			$(document).ready(function() {
				$("#btn").click(function() {
					var username = $("#username").val();
					var userpass = $("#userpass").val();

					$.ajax({
						url: "validateLogin", //请求地址
						data: { //提交的数据对象
							//第一个是变量名称，第二个是变量的值
							username: username,
							userpass: userpass
						},
						crossDomain: true,
						dataType: "json", //服务器端返回数据类型
						type: "Post", //请求方法	
						beforeSend: function(xhr) {
							//show_loading();
							//提交执行之前运行的函数				
						},
						success: function(response, status) {
							
							//提交成功之后运行的函数				
							if (response.state == 200) {
								//alert(response.message);
								loading_complete_show(response.message, 'admin/index');
							} else {
								//alert(response.message);
								loading_complete_show(response.message, 'login');
							}
						},
						error: function(XMLHttpRequest, textStatus, errorThrown) {
							//alert("请求失败!"+XMLHttpRequest.readyState+","+XMLHttpRequest.status+","+textStatus+",异常问题："+errorThrown);
							//提交失败之后运行的函数
							
						}
					});
				});
			});
		</script>
	</body>
</html>
